<?php

use think\facade\Route;
// api接口无需token模块
Route::group('api', function () {
    // 首页路由
    Route::group('index', function () {
        Route::any('index', 'api.Index/index'); //首页轮播图 公告 网站信息
        Route::any('indexdata', 'api.Index/indexdata'); //首页轮播图 公告 网站信息
        Route::any('articleList', 'api.Index/articleList'); //公告
        Route::any('articleInfo', 'api.Index/articleInfo'); //公告
        Route::any('getFreight', 'api.Index/getFreight'); //获取运费

        Route::any('getCategoryList', 'api.Index/getCategoryList'); //获取分类列表
        Route::any('getProtocol', 'api.Index/getProtocol'); //获取政策协议
        Route::any('getPolicy', 'api.Index/getPolicy'); //获取单条协议
        Route::any('indexBase', 'api.Index/indexBase'); //首页轮播图 公告 网站信息
        Route::any('getConfig', 'api.Index/getConfig');
    });
    // 微信
    Route::group('wx', function () {
        Route::any('getAccessToken', 'api.Wx/getAccessToken');
        Route::any('check', 'api.Wx/check');
    });
    Route::group('user', function () {
        Route::any('getMembershipRules', 'api.User/getMembershipRules');//获取会员规则

        Route::any('register', 'api.User/register');    //会员注册
        Route::any('login', 'api.User/login');    //会员登录

    });
    // 支付回调
    Route::group('notify', function () {
        Route::any('wxPayNotify', 'api.Notify/wxPayNotify');// 微信订单支付回调
        Route::any('wxRechargeNotify', 'api.Notify/wxRechargeNotify');//微信余额充值支付回调
        Route::any('wxOrderUpgradeNotify', 'api.Notify/wxOrderUpgradeNotify');//微信余额充值支付回调

        Route::any('aliPayNotify', 'api.Notify/aliPayNotify');// 支付宝订单支付回调
        Route::any('aliPayRechargeNotify', 'api.Notify/aliPayNotify');// 支付宝订单支付回调
    });

    Route::group('goods', function () {
        Route::any('getGoodsLists', 'api.Goods/getGoodsLists');
    });

    Route::group('ceshi', function () {
        Route::any('ceshi', 'api.Ceshi/ceshi');//购物车列表
    });
})->allowCrossDomain();

// api接口模块
Route::group('api', function () {
    // 地址路由
    Route::group('address', function () {
        Route::any('setDefaultAddress', 'api.Address/setDefaultAddress');
        Route::any('getDefaultAddress', 'api.Address/getDefaultAddress');
        Route::any('getAddressList', 'api.Address/getAddressList');
        Route::any('setAddress', 'api.Address/setAddress');
        Route::any('delAddress', 'api.Address/delAddress');
    });
    // 用户信息
    Route::group('user', function () {
        Route::any('getUserInfo', 'api.User/getUserInfo');
        Route::any('sendSmsCode', 'api.User/sendSmsCode');
        Route::any('loginOut', 'api.User/loginOut');
        Route::any('withdraw', 'api.User/withdraw');    //提现
        Route::any('getWithdrawList', 'api.User/getWithdrawList');
        Route::any('bindMobile', 'api.User/bindMobile');
        Route::any('unbindMobile', 'api.User/unbindMobile');
        Route::any('changeMobile', 'api.User/changeMobile');
        Route::any('getCommissionList', 'api.User/getCommissionList');
        Route::any('setWithdrawInfo', 'api.User/setWithdrawInfo');
        Route::any('getWithdrawInfo', 'api.User/getWithdrawInfo');
        Route::any('getUserAddress', 'api.User/getUserAddress');
        Route::any('setUserAddress', 'api.User/setUserAddress');
        Route::any('getUserPaymentInfo', 'api.User/getUserPaymentInfo');
        Route::any('getUserQrcode', 'api.User/getUserQrcode');
        Route::any('getUserLevel', 'api.User/getUserLevel');
        Route::any('getTeamInfo', 'api.User/getTeamInfo');
        Route::any('getTeamList', 'api.User/getTeamList');
        Route::any('getTeamIncomeList', 'api.User/getTeamIncomeList');
        Route::any('signIn', 'api.User/signIn');//签到


        Route::any('integralRecord', 'api.User/integralRecord');//积分记录
        Route::any('setDefaultAddress', 'api.User/setDefaultAddress');//设置默认地址
        Route::any('getMyShop', 'api.User/getMyShop');//查看店铺地址
        Route::any('getWithdrawConfig', 'api.User/getWithdrawConfig');//查看店铺地址


        Route::any('setUserInfo', 'api.User/setUserInfo');//设置个人信息
        Route::any('submit_authentication', 'api.User/submit_authentication');//提交个人认证
        Route::any('modifyPwd', 'api.User/modifyPwd');//修改登录密码
        Route::any('modifyPaymentPwd', 'api.User/modifyPaymentPwd');//修改支付密码
        Route::any('getBankList', 'api.User/getBankList');//获取银行卡列表
        Route::any('setBank', 'api.User/setBank');//获取银行卡列表
        Route::any('applyShop', 'api.User/applyShop');//入驻商家提交
        Route::any('rechargeBalance', 'api.User/rechargeBalance');//余额充值
        Route::any('balanceRecord', 'api.User/balanceRecord');//余额记录
        Route::any('integralRecord', 'api.User/integralRecord');//积分记录
        Route::any('greenScoresRecord', 'api.User/greenScoresRecord');//绿色积分记录
        Route::any('wallet','api.User/wallet'); //钱包
    });
    // 商品
    Route::group('goods', function () {
        Route::any('collect', 'api.Goods/collect');//收藏技师
        Route::any('getGoodsCollectList', 'api.Goods/getGoodsCollectList');
        Route::any('getGoodsGiftInfo', 'api.Goods/getGoodsGiftInfo');
        Route::any('getGoodsShareImg', 'api.Goods/getGoodsShareImg');

        //詳情
        Route::any('getGoodsdetails', 'api.Goods/getGoodsdetails');
        //积分商城列表
        Route::any('getPointsMall', 'api.Goods/getPointsMall');

        Route::post('getCollectList', 'api.Goods/getCollectList');// 商品收藏列表
        Route::any('evaluationList', 'api.Goods/evaluationList');// 商品评论列表
        Route::any('getShopGoodsLists', 'api.Goods/getShopGoodsLists');// 店铺商品列表
    });
    // 订单
    Route::group('order', function () {
        Route::any('buyOrderDetail', 'api.Order/buyOrderDetail');
        Route::any('getOrderCouponList', 'api.Order/getOrderCouponList');//订单详情优惠券列表

        Route::any('getOrderList', 'api.Order/getOrderList');//获取订单列表

        Route::any('cancelOrder', 'api.Order/cancelOrder');//取消订单

        Route::any('getPayInfo', 'api.Order/getPayInfo');//支付详情
        Route::any('createRechargeOrder', 'api.Order/createRechargeOrder');//余额充值
        Route::any('addHourOrder', 'api.Order/addHourOrder');//订单加钟
        Route::any('upgradeOrder', 'api.Order/upgradeOrder');//订单升级

        Route::any('getShopList', 'api.Order/getShopList');//商品列表
        Route::any('getShoppingCart', 'api.Order/getShoppingCart');//购物车列表
        Route::any('delShoppingCart', 'api.Order/delShoppingCart');//删除购物车
        Route::any('cartBuyOrder', 'api.Order/cartBuyOrder');//删除购物车
        Route::any('createOrderQrcode', 'api.Order/createOrderQrcode');//提货二维码
        Route::any('redemptionPoints', 'api.Order/redemptionPoints');//积分兑换商品


        Route::any('submitEvaluation', 'api.Order/submitEvaluation');//订单评价
        Route::any('createOrder', 'api.Order/createOrder');//创建订单
        Route::any('getOrderDetail', 'api.Order/getOrderDetail');//获取订单详情
        Route::any('pay', 'api.Order/pay');//订单支付
        Route::any('cancelOrder', 'api.Order/cancelOrder');//取消订单
        Route::any('confirmReceipt', 'api.Order/confirmReceipt');//确认收货
        Route::any('setCartOrder', 'api.Order/setCartOrder');//购物车下单
        Route::any('confirmOrder', 'api.Order/confirmOrder');//购物车列表
        Route::any('confirmOrder2', 'api.Order/confirmOrder2');//购物车列表
        Route::any('createOrder2', 'api.Order/createOrder2');//购物车列表
        Route::any('after_sales', 'api.Order/after_sales');//购物车列表
        Route::any('getAfterSalesList', 'api.Order/getAfterSalesList');//购物车列表
    });
    // 图片
    Route::group('image', function () {
        Route::any('upload', 'api.Image/upload');
        Route::any('upload111', 'api.Image/upload111');
    });
    // 推广
    Route::group('promote', function () {
        //Route::any('index', 'api.Promote/index');// 推荐人
        //Route::any('getPromoteList', 'api.Promote/getPromoteList');//推广记录
        Route::any('getTeamList', 'api.Promote/getTeamList');//推荐人列表
        Route::post('applyForRewards', 'api.Promote/applyForRewards');//申请奖励
        Route::post('accumulated_rewards', 'api.Promote/accumulated_rewards');//申请奖励
    });
    // 榜单
    Route::group('ranking', function () {
        Route::any('promoteList', 'api.Ranking/promoteList');
        Route::any('incomeList', 'api.Ranking/incomeList');
    });
    // 优惠券
    Route::group('coupon', function () {
        Route::any('getUserCouponList', 'api.Coupon/getUserCouponList');
        Route::any('getCoupon', 'api.Coupon/getCoupon');
        Route::any('checkCoupon', 'api.Coupon/checkCoupon');
    });
    // 余额记录
    Route::group('balance', function () {
        Route::any('getUserBalanceList', 'api.Balance/getUserBalanceList');
        Route::any('getUserBalanceChangeList', 'api.Balance/getUserBalanceChangeList');
    });
    Route::group('pay', function () {
        Route::any('rechargePay', 'api.Pay/rechargePay');
        Route::any('getPayInfo', 'api.Pay/getPayInfo');

        Route::any('pay', 'api.Pay/pay');   //订单支付
        Route::any('rechargePay', 'api.Pay/rechargePay');   //余额订单支付
    });
    Route::group('tech', function () {
//        Route::any('getTechList', 'api.Technician/getTechList');// 技师列表
        Route::any('getOpenCityList', 'api.Technician/getOpenCityList');//开放城市
        Route::any('getTechGoodsList', 'api.Technician/getTechGoodsList');// 技师开通的服务列表
        Route::any('getPartnerInfo', 'api.Technician/getPartnerInfo');// 技师所在店铺信息
        Route::any('getOpenShopList', 'api.Technician/getOpenShopList');// 某个城市已开通店铺
//        Route::any('locationAnalysis', 'api.Technician/locationAnalysis');// 经纬度解析
        Route::any('saveTechInfo', 'api.Technician/saveTechInfo');// 添加技师
        Route::any('getTechInfo', 'api.Technician/getTechInfo');// 技师信息
    });
    Route::group('partner', function () {
        Route::any('savePartnerInfo', 'api.Partner/savePartnerInfo');// 添加店铺
    });
    Route::group('evaluate', function () {
        Route::any('evaluate', 'api.Evaluate/evaluate');//技师评价
    });

    // 购物车
    Route::group('cart', function () {
        Route::any('getList', 'api.Cart/getList');//购物车列表
        Route::any('add', 'api.Cart/add');  //添加购物车
        Route::any('edit', 'api.Cart/edit');    //更新购物车
        Route::any('del', 'api.Cart/del');  //删除购物车
        Route::any('getCount', 'api.Cart/getCount');  //删除购物车

    });

})->allowCrossDomain()->middleware('api_auth');